Chore/legacy cleanup - #61
Merged
Merged
Conversation
Shift target mode/option/filter validation out of shared descriptors into provider implementations, and extend the provider contract with `resolve_target_filters` and `prepare_target` for provider-owned preflight state and scheduling keys. This also unifies runner auth/preparation/execution flow around provider APIs, migrates AWS account/auth/session modules under `providers/aws`, and updates loaders to use shared component descriptors. Results were enriched with provider/entity metadata and task action output, and schemas/tests were updated to reflect provider-owned target semantics.
- Extract `validate_keyword_only_invocation` into `_components.py` and reuse it for both task and processor signature validation, replacing duplicated inspection logic - Replace `task_validation_errors(resolved)` with `task_validation_errors(descriptors)` so validation loads callables from descriptors directly; add `task_catalog_ambiguity_errors` for provider-scoped duplicate detection - Split `_provider_task_discovery` into `_universal_task_catalog` and `_provider_specific_task_catalog` caches so universal tasks are discovered once across all providers - `ProcessorRunContext` now snapshots mutable inputs in `__post_init__`, derives `target_result` and `target_result_path` as properties, and validates target-selection invariants - `TaskCallContext.to_kwargs()` returns a fresh metadata copy; add `keyword_names()` classmethod - `run_processors` passes a `replace(context)` snapshot and a fresh metadata dict to each processor invocation - Remove `ConfigBranch` dependency from `ProcessorRunContext`, `html_report`, `sarif_report`, and related call sites - Drop `kind` field from `PackageComponentSource`; add `provider` parameter to `source_from_entry_point` - Add docstring validation for processors and expand test coverage for isolation, ambiguity, and context invariants
Simplifies the config and execution model to schema v2 `targets` only by removing `ConfigBranch` from descriptors, results, runner, CLI, providers, and validators. Result payloads now consistently use `target`/`targets`, branch-specific guards and label mapping were removed, and task execution now calls `task.run(**context.to_kwargs())` directly (deleting the task invocation shim). The provider contract was tightened to require a `preparation` parameter on `resolve_execution_targets`, and tests were updated accordingly (including renaming org-validation tests to target-validation).
Allow `entity_metadata` in result field selection so result queries can include that data. Also align target validation messaging and tests with the newer entity-region terminology, and clean up the validate command test stub to match the current provider interface.
Adds `tool.ty` configuration to support optional SDK imports and to relax strict type rules in tests, then updates GitHub provider/task code with Protocol-based client/requester typing and safer mapping normalization for REST results. Also improves local typing in benchmark/test helpers and renames the auth test file to remove the space in its filename.
- Cached completed provider and processor catalogs with lru_cache(maxsize=1). - Added centralized cache-clearing functions that invalidate both cache layers. - Updated plugin/import-safety tests to clear snapshots explicitly. -Added five regression tests covering single scans, refresh after clearing, and repeated task listing. Measured warm-call improvement: Provider listing: ~1.8 ms → ~0.0003 ms Processor listing: ~1.8 ms → ~0.0007 ms Task listing: ~1.9 ms → ~0.009 ms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Refactors Anvil’s target pipeline around a provider-owned contract. Providers now control target validation, filtering, preparation, and execution-target resolution, while the shared runner focuses on orchestration and scheduling.
This also removes the legacy
ConfigBranchabstraction, standardizes result payloads ontarget/targets, strengthens task and processor validation, and caches component discovery for substantially faster repeated listings.Key changes
resolve_target_filtersprepare_targetanvil.providers.aws.ConfigBranchthroughout descriptors, CLI handling, validation, execution, processors, and result serialization.TaskCallContext.targetandtargets.tyconfiguration for optional SDK imports and structurally typed test doubles.Performance
Warm component-listing calls improve from roughly:
1.8 ms→0.0003 ms1.8 ms→0.0007 ms1.9 ms→0.009 msBreaking changes
ConfigBranchand branch-specific result handling have been removed.targetandtargets.resolve_execution_targetsnow accepts provider preparation data.run()functions must use supported keyword-only parameters and provide documentation compatible with detailed CLI listings.anvil.providers.aws.Checklist
ruffandpytest) were successful.